import 'package:flutter/material.dart';

class InnerShadow extends StatelessWidget {
  final Color color;
  final Color shadowColor;
  final double blurRadius;
  final BorderRadius borderRadius;
  final BoxBorder? border;
  final Widget? child;

  const InnerShadow({
    super.key,
    this.color = Colors.transparent,
    this.shadowColor = Colors.black,
    this.blurRadius = 0,
    this.borderRadius = BorderRadius.zero,
    this.border,
    this.child,
  });

  @override
  Widget build(BuildContext context) {
    double factor = 1.4;
    List<Widget> children = [
      Positioned.fill(
        child: Ink(
          padding: EdgeInsets.all(blurRadius * factor),
          decoration: BoxDecoration(color: shadowColor, borderRadius: borderRadius, border: border),
          child: Ink(
            decoration: BoxDecoration(
              color: color,
              borderRadius: borderRadius,
              boxShadow: [BoxShadow(color: color, blurRadius: blurRadius, spreadRadius: blurRadius * factor)],
            ),
          ),
        ),
      ),
    ];
    if (child != null) children.add(child!);
    return Material(
      color: Colors.transparent,
      child: Stack(alignment: Alignment.center, children: children),
    );
  }
}
